import { Rule, RuleType } from '@midwayjs/validate';
import { ApiProperty } from '@midwayjs/swagger';

export class RegisterDTO {
  
  @ApiProperty({
    description: '邮箱',
    example: 'test@example.com',
    required: true,
  })
  @Rule(RuleType.string().required().email().error(new Error('邮箱格式不正确')))
  email: string;

  @ApiProperty({
    description: '验证码',
    example: '123456',
    required: true,
  })
  @Rule(RuleType.string().required().length(6).error(new Error('验证码格式不正确')))
  emailCode: string;

  @ApiProperty({
    description: '密码',
    example: '123456',
    required: true,
  })
  @Rule(RuleType.string().required().min(6).error(new Error('密码长度不能小于6位')))
  password: string;

  @ApiProperty({
    description: '确认密码',
    example: '123456',
    required: true,
  })
  @Rule(RuleType.string().required().min(6).error(new Error('确认密码长度不能小于6位')))
  confirmPassword: string;
  
}

export class LoginEmailDTO {
  @ApiProperty({
    description: '邮箱',
    example: 'test@example.com',
    required: true,
  })
  @Rule(RuleType.string().required().email().error(new Error('邮箱格式不正确')))
  email: string;

  @ApiProperty({
    description: '密码',
    example: '123456',
    required: true,
  })
  @Rule(RuleType.string().required().min(6).error(new Error('密码长度不能小于6位')))
  password: string;
} 
